package com.ewanghuiju.app.ui.pintuan.adapter;

import android.graphics.Paint;
import android.text.TextUtils;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewanghuiju.app.R;
import com.ewanghuiju.app.component.ImageLoader;
import com.ewanghuiju.app.model.bean.response.PintuanShopListResponBean;
import com.ewanghuiju.app.util.StringUtil;
import com.makeramen.roundedimageview.RoundedImageView;

/**
 * @author sj  qq:751943509
 * @class describe
 * @time 2020/2/20
 */
public class PintuanShopListAdapter extends BaseQuickAdapter<PintuanShopListResponBean, BaseViewHolder> {
    public PintuanShopListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, PintuanShopListResponBean item) {
        TextView tv_title = helper.getView(R.id.tv_shop_title);
        StringUtil.getTextStrFormat(tv_title, item.getPeople_number() + "人团", item.getGoods_name());
        helper.setText(R.id.tv_spe_price, item.getSpe_price());
        helper.setText(R.id.iv_title_icon, item.getPeople_number() + "人团");
        helper.setText(R.id.tv_salse, "已拼" + item.getOff_group_sum() + "件");
        TextView tv_yuan = helper.getView(R.id.tv_yuan_price);
        tv_yuan.setText("￥" + item.getYuan_price());

        tv_yuan.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); // 设置中划线并加清晰
        RoundedImageView riv = helper.getView(R.id.riv_item_icon);
        if (!TextUtils.isEmpty(item.getImage())) {
            ImageLoader.load(mContext, item.getImage(), riv);
        }
    }
}
